#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
#define int long long
const int N = 1e7;

vector<bool> isp(N + 1, true);
vector<int> p;
vector<int> c(N + 1, 0);

void pre() {
    isp[0] = isp[1] = false;
    for (int i = 2; i <= N; ++i) {
        if (isp[i]) {
            p.push_back(i);
            if ((int)i * i > N) continue;
            for (int j = (int)i * i; j <= N; j += i) {
                isp[j] = false;
            }
        }
    }

    int cnt = 0;
    for (int i = 0; i <= N; ++i) {
        if (i >= 2 && isp[i]) {
            cnt++;
        }
        c[i] = cnt;
    }
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    pre();

    int t;
    cin >> t;

    while (t--) {
        int n;
        cin >> n;
        int s = sqrt(n);
        int sum1 = 0;
        for (int x : p) {
            if (x > s) break;
            sum1 += n / x;
        }

        int sum2 = 0;
        for (int k = 1; k <= s; ++k) {
            int m = n / (k + 1);
            int m2 = n / k;
            if (m2 <= s) continue;
            sum2 += k * (c[m2] - c[m]);
        }

        cout << sum1 + sum2 << '\n';
    }

    return 0;
}